/**
 *
union的大小除了是最大的成员变量类型所占字节外，也必须是成员所占类型字节的整数倍
 */
#include<stdio.h>

union un
{
	char a;
	int b;
	double c;
};

union un1
{
	int a;
	char s[7];
};

union un2
{
	char a;
	char s[7];
};

union un3
{
	int a;
	char b;
	char c;
};
union un4
{
	char a;
	int b;
	char c;
};

int main(){
	printf("%ld\n",sizeof(union un));//8
	printf("%ld\n",sizeof(union un1));//8
	printf("%ld\n",sizeof(union un2));//7
	printf("%ld\n",sizeof(union un3));//4
	printf("%ld\n",sizeof(union un4));//4
	return 0;
}
